import { Injectable } from '@nestjs/common';
import { CaptchaService } from '../captcha/captcha.service';
import { Cron, CronExpression } from '@nestjs/schedule';

@Injectable()
export class TasksService {
  constructor(private readonly captchaService: CaptchaService) {}

  @Cron(CronExpression.EVERY_DAY_AT_1AM)
  async deleteInvalidCaptcha(): Promise<void> {
    this.captchaService.clearOutDateCode();
  }
}
